package com.ywj.collection.MySet;

import java.util.TreeSet;

public class TreeSetDemo01 {
    public static void main(String[] args) {
        TreeSet<Integer> ts = new TreeSet<>();
        ts.add(20);
        ts.add(10);
        ts.add(40);
        ts.add(50);
        ts.add(30);

        for (Integer t : ts) {
            System.out.println(t);
        }
        System.out.println(ts);  //[10, 20, 30, 40, 50]
    }
}
